package com.lzl.controller;

import com.lzl.responese.ResponseResult;
import com.lzl.responese.NumberCodeResponese;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class NumberCodeController {

    @GetMapping("/numberCode/{size}")
    public  ResponseResult numberCode(@PathVariable("size") int size){
        //生成验证码
        int code = (int)((Math.random() * 9 + 1) * Math.pow(10,size-1));

        //将验证码存入redis
        System.out.println("将验证码存入redis");

        NumberCodeResponese responseResult = new NumberCodeResponese();
        responseResult.setNumberCode(code);

        return ResponseResult.success(responseResult);

    }



}
